package com.neuedu.income.controller;

import com.neuedu.po.Income;
import com.neuedu.income.service.IncomeService;
import com.neuedu.income.service.IncomeServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/income")
public class IncomeController {
    @Autowired
    private IncomeService service;
    @Autowired
    private IncomeService IncomeServiceImpl;

    @RequestMapping("/selectAll")
    // http://localhost:8088/income/selectAll?uname=t
    public List<Income> selectAll(Income i){
        return service.selectAll(i);
    }

    @RequestMapping("/add")
    // http://localhost:8088/income/add?uname=marry&pass=888&&account=12345678904&sal=5000.0&homecall=sister&age=20&power=user
    public int add(Income i){
        return service.add(i);
    }

    @RequestMapping("/update")
    // http://localhost:8088/income/update?uname=sophia&pass=888&&account=12345678904&sal=5000.0&homecall=sister&age=20&power=user&id=4
    public int update(Income i){
        return service.update(i);
    }

    @RequestMapping("/delete")
    // http://localhost:8088/income/delete?id=4
    public int delete(Income i){
        return service.delete(i);
    }
}
